<?php defined('SYSPATH') or die('No direct script access');

class Application_Model extends ORM {
	
	protected $_created_column = array('column' => 'date_created', 'format' => 'Y-m-d H:i:s');
	
	protected $_updated_column = array('column' => 'date_updated', 'format' => 'Y-m-d H:i:s');
	
	protected $_belongs_to = array(
		'status_changed_by'		=> array('model' => 'user', 'foreign_key' => 'status_changed_by'),
		'host'					=> array('model' => 'host', 'foreign_key' => 'host_id'),
		'account'				=> array('model' => 'account', 'foreign_key' => 'account_id'),
		'person'				=> array('model' => 'person', 'foreign_key' => 'person_id'),
		'address'				=> array('model' => 'address', 'foreign_key' => 'address_id'),
		'picture'				=> array('model' => 'picture', 'foreign_key' => 'picture_id'),
		'topic'					=> array('model' => 'topic', 'foreign_key' => 'topic_assigned'),
		'topic_one'				=> array('model' => 'topic', 'foreign_key' => 'topic_choise_one'),
		'topic_two'				=> array('model' => 'topic', 'foreign_key' => 'topic_choise_two'),
		'topic_three'			=> array('model' => 'topic', 'foreign_key' => 'topic_choise_three'),
		'group'					=> array('model' => 'group', 'foreign_key' => 'group_assigned'),
		'experience_choise'		=> array('model' => 'experience', 'foreign_key' => 'experience_choise'),
		'experience_assigned'	=> array('model' => 'experience', 'foreign_key' => 'experience_assigned'),
		'source'				=> array('model' => 'source', 'foreign_key' => 'source_id')		
	);
	
	protected $_rules = array(
		'response' => array(
			'not_empty'	=> NULL,
			'regex'		=> array('/^(yes|no|visum|travel)$/'),
		),
		'travel_means' => array(
			'not_empty' => NULL,
			'regex'		=> array('/^(plane|train|bus|car|other)$/'),
		),
		'accomodation' => array(
			'not_empty' => NULL,
			'regex'		=> array('/^(female|male|doesnt.matter)$/'),
		),
		'food' => array(
			'not_empty' => NULL,
			'regex'		=> array('/^(vegetarian|kosher|nopork|doesnt.matter|extra)$/'),
		),
	);
}

?>